
#ifndef __UART_H
#define __UART_H

//TX1 RC6
//RX1 RC7

#define usb_midi_op
//#define debug_op

#ifdef usb_midi_op

#define TXxSTAbits TX1STAbits
#define BAUDCONxbits BAUDCONbits
#define RCSTAxbits RCSTAbits
#define SPBRGHx SPBRGH1
#define SPBRGx SPBRG1
#define TX_OUT TRISCbits.TRISC6
#define RX_IN TRISCbits.TRISC7
#define TXIF   PIR1bits.TX1IF
#define TXIP   IPR1bits.TX1IP
#define TXIE   PIE1bits.TX1IE
#define TRMT   TXSTA1bits.TRMT
#define TXRG   TXREG1

#endif
#ifdef debug_op

#define TXxSTAbits TX2STAbits
#define BAUDCONxbits BAUDCON2bits
#define RCSTAxbits RCSTA2bits
#define SPBRGHx SPBRGH2
#define SPBRGx SPBRG2
#define TX_OUT TRISBbits.TRISB6
#define RX_IN TRISBbits.TRISB7
#define TXIF   PIR3bits.TX2IF
#define TXIP   IPR3bits.TX2IP
#define TXIE   PIE3bits.TX2IE
#define TRMT   TXSTA2bits.TRMT
#define TXRG   TXREG2

#endif


void init_debug_uart(void);

void init_uart (void);

void buffer_midi_command_byte(UINT8 byte);

void tx_midi_command_byte(void);

#endif